package org.example.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class AjaxResult {
    private int code;
    private String message;
    private Object data;

    public static AjaxResult ok() {
        return new AjaxResult(200, "success", null);
    }

    public static AjaxResult ok(Object data) {
        return new AjaxResult(200, "success", data);
    }

    public static AjaxResult err() {
        return new AjaxResult(500, "error", null);
    }

    public static AjaxResult err(String message) {
        return new AjaxResult(500, message, null);
    }

    public static AjaxResult err(int code, String message) {
        return new AjaxResult(code, message, null);
    }
}
